﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace BDH.DAL
{
    using DAL.Entities;
    public class DongiaDAL : BaseDAL, BDH.UTL.IBaseDAL
    {
        public int Count()
        {
            throw new NotImplementedException();
        }

        public DataTable Select()
        {
            throw new NotImplementedException();
        }

        public DataTable Select(string id)
        {
            throw new NotImplementedException();
        }

        public DataTable Select(int id)
        {
            string sql = @" SELECT id,giadien,gianuoc,ngay FROM Dongia WHERE nhatro_id = '{0}' ";
            sql = string.Format(sql, id);
            return ExecuteQuery(sql);
        }

        public DataTable Select(string id1, string id2)
        {
            throw new NotImplementedException();
        }

        public DataTable Select(object obj)
        {
            throw new NotImplementedException();
        }

        public object GetByKey(object key)
        {
            throw new NotImplementedException();
        }

        public bool Delete(long id)
        {
            throw new NotImplementedException();
        }

        public bool Insert(object obj)
        {
            var o = (Dongia)obj;
            string sql = @" INSERT INTO Dongia(giadien,gianuoc,ngay,nhatro_id) VALUES('{0}', '{1}', '{2}', '{3}') ";
            sql = string.Format(sql, o.giadien, o.gianuoc, o.ngay, o.nhatro_id);
            return ExecuteNonQuery(sql) > 0 ? true : false;
        }

        public bool Update(object obj)
        {
            throw new NotImplementedException();
        }
    }
}
